import java.util.LinkedList;
import java.util.Scanner;

public class TestDay21 {

    //洗牌
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int z = scanner.nextInt();
        for (int i = 0; i < z; i++) {
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            LinkedList<Integer> list = new LinkedList<>();
            for (int j = 0; j < 2*n; j++) {
                list.add(scanner.nextInt());
            }
            LinkedList<Integer> list1 = new LinkedList<>();
            LinkedList<Integer> list2 = new LinkedList<>();
            for (int m = 0; m < k; m++) {
                for (int j = 0; j < n; j++) {
                    list1.add(list.pollFirst());
                }
                for (int j = 0; j < n; j++) {
                    list2.add(list.pollFirst());
                }
                for (int j = 0; j < 2*n; j++) {
                    if(j % 2 == 0){
                        list.add(list1.pollFirst());
                    }else {
                        list.add(list2.pollFirst());
                    }
                }
            }
            for (Integer q:list) {
                System.out.print(q+" ");
            }
            System.out.println();

        }
    }
    //选歌
    //一维数组
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        //创建一维数组
        int[]array = new int[n];
        for (int i = 0; i < array.length; i++) {
            array[i] = i+1;
        }
        int p = 1;//光标
        scanner.nextLine();
        String str = scanner.nextLine();
        int z = 4;//默认为4
        //如果n<=4,那就控制最后一格的位置
        if(n <= 4){
            z = n;
        }
        int sum = 1;//sum==1第一格,sum==4最后一格
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if(ch == 'U'){
                if(p == 1){
                    //此时为第一页的第一格
                    p = n;
                    //默认为4,其余情况就是数组最长长度
                    sum = z;
                }else {
                    //向上一格
                    //如果已经是第一格的话,下次更新之后的光标依旧说第一格
                    if(sum != 1){
                        sum--;
                    }
                    p--;
                }
            }else {
                if(p == n){
                    p = 1;
                    sum = 1;
                }else {
                    //默认为4,其余情况就是数组最长长度
                    if(sum != z) {
                        sum++;
                    }
                    p++;
                }
            }
        }
        for (int i = p-sum; i <p-sum+4 ; i++) {
            if(i == n){
                break;
            }
            System.out.print(array[i]+" ");
        }
        System.out.println();
        System.out.println(array[p-1]);
    }
}
